// import { soptAssetData } from "@/data/mockData";
import { get } from "@/http/http";


export function spotFunds() {
  const originalElement = document.querySelectorAll(
    ".valuation-detail > .hidden-funds-num"
  );
  console.log(originalElement, "originalElement");
  const originalElementBTC = document.querySelectorAll(
    ".valuation-exchange > .hidden-funds-num"
  );
  console.log(originalElementBTC, "originalElementBTC");
  if (originalElement && originalElementBTC) {
    get('/data/basic/spot/funds').then(res => {
      const { spotAssets, spotAssetsBTC, accumulatedProfit, accumulatedProfitBTC, tadayProfit, tadayProfitBTC } = res.data
      const assetValue = [
        spotAssets,
        accumulatedProfit,
        tadayProfit,
      ];
      const assetValueBTC = [
        spotAssetsBTC,
        accumulatedProfitBTC,
        tadayProfitBTC,
      ];
      originalElement.forEach((item, index) => {
        item.innerHTML = assetValue[index].toFixed(2);
      });
      originalElementBTC.forEach((item, index) => {
        item.innerHTML = `≈ ${assetValueBTC[index].toFixed(6)} BTC`
      });
    })

  }

}

